#include <iostream>
#include <cstdio>

using namespace std;

const int N = 5e6 + 10;

int q[N];
int n, k;

int quickSe(int l, int r)
{
	if (l >= r) return q[k];
	
	int left = l - 1;
	int right = r + 1;
	int standard = q[l + r >> 1];
	
	while (left < right)
	{
		while (q[ ++ left] < standard);
		while (q[-- right] > standard);
		if(left < right) swap(q[left], q[right]); 
	}
	
	if (right < k) return quickSe(right + 1, r);
	else return quickSe(l, right);
}

int main()
{
//	cin >> n;
	scanf("%d%d", &n, &k);
	
	for (int i = 0; i < n; i ++ ) scanf("%d", &q[i]);
	
	cout << quickSe(0, n - 1) << endl;
	
//	for (int i = 0; i < n; i ++ ) cout << q[i] << ' ';
	
	return 0;
} 
